<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]>      <html class="no-js"> <!--<![endif]-->
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="">
  </head>
  <body>
    <input type="file"  id="fileBtn" multiple value="选择文件">
    <script src="https://cdn.bootcdn.net/ajax/libs/blueimp-md5/2.16.0/js/md5.js"></script>

    <script> 
     let fileBtn = document.getElementById("fileBtn");   
     async function promiseWrapper(file){
        let fileReader = new FileReader();
        return new Promise(function(resolve){
          fileReader.readAsBinaryString(file);
          fileReader.onload = function(){
            resolve('读取文件成功' + md5(this.result) )
          } 
        })     
      }
     fileBtn.onchange = function(e){
      let files = this.files;
   
      for(let i = 0; i< files.length; i++){
        promiseWrapper(files[i]).then(res=>{
          console.log(res)
        })
      }
      


     
     }


    </script>
  </body>
</html>